.class public Lcom/teewoo/app/bus/util/SearchUtil;
.super Ljava/lang/Object;
.source "SearchUtil.java"


# static fields
.field public static final BASE_API:Ljava/lang/String; = "http://api.5320000.com/"

.field public static final CHANGE_API:Ljava/lang/String; = "bus/search/switch.xml"

.field public static final E_STATION_API:Ljava/lang/String; = "bus/line_station.xml"

.field public static final LINE_API:Ljava/lang/String; = "bus/search/line.xml"

.field public static final LINE_DETAIL_API:Ljava/lang/String; = "bus/line.xml"

.field public static final LINE_PASS_API:Ljava/lang/String; = "bus/station.xml"

.field public static final METHOD_GET_FLAG:Ljava/lang/String; = "?"

.field public static final PARAMETER_CONNECT:Ljava/lang/String; = "&"

.field public static final PARAM_FROM:Ljava/lang/String; = "from="

.field public static final PARAM_ID:Ljava/lang/String; = "id="

.field public static final PARAM_LAT:Ljava/lang/String; = "lat="

.field public static final PARAM_LINE_ID:Ljava/lang/String; = "line_id="

.field public static final PARAM_LON:Ljava/lang/String; = "lon="

.field public static final PARAM_PAGE:Ljava/lang/String; = "page="

.field public static final PARAM_QUERY:Ljava/lang/String; = "query="

.field public static final PARAM_RANGE:Ljava/lang/String; = "range="

.field public static final PARAM_SORT:Ljava/lang/String; = "sort="

.field public static final PARAM_STATION_ID:Ljava/lang/String; = "station_id="

.field public static final PARAM_TO:Ljava/lang/String; = "to="

.field public static final SORT_DISTANCE:Ljava/lang/String; = "distance"

.field public static final STATION_API:Ljava/lang/String; = "bus/search/station.xml"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 12
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getBusLocation(II)Lcom/teewoo/app/bus/model/Line;
    .locals 5
    .parameter "lineId"
    .parameter "stationId"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 175
    const/4 v1, 0x0

    .line 176
    .local v1, line:Lcom/teewoo/app/bus/model/Line;
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 177
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/line_station.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 178
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "line_id="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p0}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 179
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "station_id="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    .line 183
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 184
    .local v0, inStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 185
    invoke-static {v0}, Lcom/teewoo/app/bus/util/PullXmlReader;->getBusLocation(Ljava/io/InputStream;)Lcom/teewoo/app/bus/model/Line;

    move-result-object v1

    .line 186
    :cond_0
    return-object v1
.end method

.method public static getChangeSolutions(II)Ljava/util/List;
    .locals 5
    .parameter "fromId"
    .parameter "toId"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(II)",
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Solution;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 155
    const/4 v1, 0x0

    .line 156
    .local v1, solutions:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/Solution;>;"
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 157
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/search/switch.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 158
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "from="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p0}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 159
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "to="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    .line 162
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 163
    .local v0, inStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 164
    const-string v3, "UTF-8"

    invoke-static {v0, v3}, Lcom/teewoo/app/bus/util/PullXmlReader;->getAllSolutions(Ljava/io/InputStream;Ljava/lang/String;)Ljava/util/List;

    move-result-object v1

    .line 165
    :cond_0
    return-object v1
.end method

.method public static getLineByKeyWord(Ljava/lang/String;)Ljava/util/List;
    .locals 5
    .parameter "keyWord"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Line;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 92
    const/4 v1, 0x0

    .line 94
    .local v1, lines:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/Line;>;"
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 95
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/search/line.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 96
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "query="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 97
    invoke-static {p0}, Ljava/net/URLEncoder;->encode(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 99
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 100
    .local v0, inStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 101
    invoke-static {v0}, Lcom/teewoo/app/bus/util/PullXmlReader;->getLines(Ljava/io/InputStream;)Ljava/util/List;

    move-result-object v1

    .line 102
    :cond_0
    return-object v1
.end method

.method public static getLinePassBy(I)Ljava/util/List;
    .locals 5
    .parameter "stationId"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I)",
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Line;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 76
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 77
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/station.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 78
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "id="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p0}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    .line 79
    const/4 v1, 0x0

    .line 80
    .local v1, lines:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/Line;>;"
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 81
    .local v0, inputStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 82
    const-string v3, "utf-8"

    invoke-static {v0, v3}, Lcom/teewoo/app/bus/util/PullXmlReader;->getLinePassBy(Ljava/io/InputStream;Ljava/lang/String;)Ljava/util/List;

    move-result-object v1

    .line 83
    :cond_0
    return-object v1
.end method

.method public static getLineStations(I)Lcom/teewoo/app/bus/model/Line;
    .locals 5
    .parameter "lineId"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 112
    const/4 v1, 0x0

    .line 113
    .local v1, line:Lcom/teewoo/app/bus/model/Line;
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 114
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/line.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 115
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "id="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 116
    invoke-virtual {v3, p0}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    .line 118
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 119
    .local v0, inStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 120
    invoke-static {v0}, Lcom/teewoo/app/bus/util/PullXmlReader;->getLineDetails(Ljava/io/InputStream;)Lcom/teewoo/app/bus/model/Line;

    move-result-object v1

    .line 121
    :cond_0
    return-object v1
.end method

.method public static getNearByStation(DDII)Lcom/teewoo/app/bus/model/NearByBo;
    .locals 5
    .parameter "lat"
    .parameter "lon"
    .parameter "range"
    .parameter "page"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 57
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 58
    .local v2, url:Ljava/lang/StringBuffer;
    const-string v3, "http://api.5320000.com/"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "bus/search/station.xml"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 59
    const-string v4, "?"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "lat="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p0, p1}, Ljava/lang/StringBuffer;->append(D)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 60
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "lon="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p2, p3}, Ljava/lang/StringBuffer;->append(D)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 61
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "range="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p4}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 62
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "page="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, p5}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v3

    .line 63
    const-string v4, "&"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "sort="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    const-string v4, "distance"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 64
    new-instance v1, Lcom/teewoo/app/bus/model/NearByBo;

    invoke-direct {v1}, Lcom/teewoo/app/bus/model/NearByBo;-><init>()V

    .line 65
    .local v1, near:Lcom/teewoo/app/bus/model/NearByBo;
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "utf-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 66
    .local v0, inputStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 67
    invoke-static {v0}, Lcom/teewoo/app/bus/util/PullXmlReader;->getStations(Ljava/io/InputStream;)Lcom/teewoo/app/bus/model/NearByBo;

    move-result-object v1

    .line 68
    :cond_0
    return-object v1
.end method

.method public static getStationByKeyWord(Ljava/lang/String;)Ljava/util/List;
    .locals 6
    .parameter "keyWord"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Station;",
            ">;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 130
    const/4 v2, 0x0

    .line 132
    .local v2, stations:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/Station;>;"
    new-instance v3, Ljava/lang/StringBuffer;

    invoke-direct {v3}, Ljava/lang/StringBuffer;-><init>()V

    .line 133
    .local v3, url:Ljava/lang/StringBuffer;
    const-string v4, "http://api.5320000.com/"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v4

    const-string v5, "bus/search/station.xml"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v4

    .line 134
    const-string v5, "?"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v4

    const-string v5, "query="

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v4

    .line 135
    invoke-static {p0}, Ljava/net/URLEncoder;->encode(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 138
    invoke-virtual {v3}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v4

    const-string v5, "utf-8"

    invoke-static {v4, v5}, Lcom/teewoo/app/bus/util/WebUtils;->getWebContent(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 139
    .local v0, inStream:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 140
    invoke-static {v0}, Lcom/teewoo/app/bus/util/PullXmlReader;->getStations(Ljava/io/InputStream;)Lcom/teewoo/app/bus/model/NearByBo;

    move-result-object v1

    .line 141
    .local v1, near:Lcom/teewoo/app/bus/model/NearByBo;
    if-eqz v1, :cond_0

    .line 142
    invoke-virtual {v1}, Lcom/teewoo/app/bus/model/NearByBo;->getNearStation()Ljava/util/List;

    move-result-object v2

    .line 144
    .end local v1           #near:Lcom/teewoo/app/bus/model/NearByBo;
    :cond_0
    return-object v2
.end method
